<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page isELIgnored="false" %>
<%@ taglib uri="/permission" prefix="pe" %>

<jsp:include page="../../include/top.jsp"/>
<div class="main_body">
    <div class="span9 page_message">
        <section id="contents">
            <ul class="tab-nav nav">
                <li class="current"><a href="${BasePath}/order/institution/list?${PublicParams}">机构列表<span class="arrow fa fa-sort-up"></span></a></li>
                <li><a href="${BasePath}/order/institution/toAdd?${PublicParams}">机构添加/修改<span
                        class="arrow fa fa-sort-up"></span></a></li>
                <c:if test="${parentInstitution!= null}">
                <li><a href="${BasePath}/order/institution/toAdd?parentId=${parentId}&${PublicParams}">[${parentInstitution.name}]分院添加/修改<span
                        class="arrow fa fa-sort-up"></span></a></li>
                </c:if>
            </ul>
            <p class="normal_tips" style="display:none"><b class="fa fa-info-circle"></b></p>

            <div class="table-bar">
                <%--<div class="fl">--%>
                    <%--<div class="tools">--%>
                        <%--<pe:permission key="add">--%>
                            <%--<a class="btn btn-success"--%>
                               <%--href="${BasePath}/order/institution/toAdd?<c:if test="${parentInstitution!= null}">parentId=${parentInstitution.id}&</c:if>${PublicParams}">新增--%>
                            <%--</a>--%>
                        <%--</pe:permission>--%>
                    <%--</div>--%>
                <%--</div>--%>
                <div class="search-form fl cf">
                    <form id="myForm" name="myForm" action="${BasePath}/order/institution/list?${PublicParams}" method="post"
                          class="form-inline">
                        机构名：<input type="text" name="name" value="${name}"/>
                        <input type="submit" value="查询" class="btn btn-success " style="margin-top: -10px"/>
                        <input type="hidden" name="start" id="start" value="${start }"/>
                        <input type="hidden" name="limit" id="limit" value="${limit }"/>
                    </form>
                </div>
            </div>
            <div class="data-table">
                <div class="table-striped">
                    <table cellspacing="1">
                        <thead>
                        <tr>
                            <th>ID</th>
                            <th>机构名称</th>
                            <th>分院名称</th>
                            <th>机构性质</th>
                            <th>省市区</th>
                            <th>地址</th>
                            <th>电话</th>
                            <th>联系人</th>
                            <th>热门</th>
                            <th>网站显示</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach items="${list}" var="bean">
                            <tr>
                                <td class="id">${bean.id}</td>
                                <td>${bean.name}</td>
                                <td><c:if test="${bean.parent != null}">${bean.parent.name}</c:if>&nbsp;</td>
                                <td><c:if test="${bean.institutionType == 0}">私立</c:if><c:if test="${bean.institutionType == 1}">公立</c:if></td>
                                <td>${bean.province}${bean.city}${bean.district}</td>
                                <td>${bean.address}</td>
                                <td>${bean.phone}</td>
                                <td>${bean.contact}</td>
                                <td><c:if test="${bean.isHot == 0}">否</c:if><c:if test="${bean.isHot == 1}">是</c:if></td>
                                <td><c:if test="${bean.toWebsite == 0}">否</c:if><c:if test="${bean.toWebsite == 1}">是</c:if></td>
                                <td>
                                    <pe:permission key="update">
                                        <a href="${BasePath}/order/institution/toEdit?id=${bean.id}&${PublicParams}">修改</a>
                                        <c:if test="${bean.parentId==0}">
                                            <a href="${BasePath}/order/institution/list?parentId=${bean.id}&${PublicParams}">查看分院</a>
                                        </c:if>
                                    </pe:permission>
                                    <pe:permission key="delete">
                                        <a class="confirm ajax-get"
                                           href="${BasePath}/order/institution/multiDel?ids=${bean.id}&${PublicParams}">
                                            删除
                                        </a>
                                    </pe:permission>
                                    <c:if test="${bean.toWebsite == 1}">
                                    <a href="http://www.yitianhealth.com/institution/${bean.id}" target="_blank">预览</a>
                                    </c:if>
                                </td>
                            </tr>
                        </c:forEach>
                        </tbody>
                    </table>
                    <div class="page" id="pager"></div>
                    <script type="text/javascript">
                        var sign = 0;
                        window.onload = function () {
                            PAGER.initPager('${start}', '${total}', '${limit}', 8, 'pager', getData);
                        }
                        function getData(currentPage, pageSize) {
                            if (sign > 0) {
                                $("#start").val(currentPage);
                                $("#limit").val(pageSize);
                                $("#myForm").submit();
                            }
                            sign = 1;
                        }
                    </script>
                </div>
            </div>
        </section>
    </div>
</div>

<jsp:include page="../../include/bottom.jsp"/>